<?php
/**
 * 查询视频处理状态
 */
require_once dirname(dirname(__DIR__))."/common.php";
use app\cls\tom\Response;
use app\cls\tom\SysResource;
use app\cls\tom\Tools;
use app\cls\tom\Config;
use app\model\Video_templet;

//先从缓存里读取数据
$redis = SysResource::getRedis();
$redis_cache_key=REDIS_PREFIX."TEMPLATE_PHOTO_";
$redis_cache_data=$redis->get($redis_cache_key);
if($redis_cache_data){
    //读取缓存里的数据
    $data=json_decode($redis_cache_data);
    Response::output(0,"查询成功1",$data,count($data));
}else{
    //查询数据库
    try{
        $db = SysResource::getDB(true);
        $Video_templet=new Video_templet($db);
        $res=$Video_templet->all_tempalte_photo();
        if(empty($res)){
            Response::output(0,"查询成功",[],0);
        }else{
            $redis->setex($redis_cache_key,15,json_encode($res));
            Response::output(0,"查询成功",$res,count($res));
        }
    }catch(DBException $e){
        Response::output(-1,"系统忙碌中");
    }

}

try{

}catch(DBException $e){
    Response::output(-1,"系统忙碌中");
}



